package lesson01;

/**
 * 使用匿名类创建 Thread 子类对象
 *
 * @author wileda
 * @date 2023/01/03  17:37
 */
public class Demo04 {
    public static void main(String[] args) {
        Thread thread = new Thread(){
            @Override
            public void run() {
                while (true) {
                    System.out.println("使用匿名类创建 Thread 子类对象");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };

        thread.start();
    }
}
